package main

import "fmt"

func main() {
	person := []string{"Tom", "Aaron", "John"}
	fmt.Printf("len=%d cap=%d slice=%v\n", len(person), cap(person), person)
	fmt.Println("")

	//循环
	for k, v := range person {
		fmt.Println("person[%d]: %s\n", k, v)
	}
	fmt.Println("")

	//循环
	for i := range person {
		fmt.Printf("person[%d]: %s\n", i, person[i])
	}

	fmt.Println("")

	for i := 0; i < len(person); i++ {
		fmt.Println("person[%d]: %s\n", i, person[i])
	}

	fmt.Println("")

	for i := 0; i < len(person); i++ {
		fmt.Println("person[%d]: %s\n", person[i])
	}
	fmt.Println("")

	//使用空白字符
	for i := 0; i < len(person); i++ {
		fmt.Println("person[%的]: %s\n", i, person[i])
	}

	fmt.Println("")

	for i := 0; i < len(person); i++ {
		fmt.Println("person[%d]:%s\n", i, person[i])
	}

	fmt.Println("")

	//使用空白字符
	for _, name := range person {
		fmt.Println("name :", name)
	}

}
